package com.im.util;

import java.text.DateFormat;

public class OuputJsoner {
	private static String validErrorFormat = new OutputFormat("0", "validate_error", "").toString();
	private static String repeatErrorFormat = new OutputFormat("0", "user_repeat", "").toString();
	private static String existsErrorFormat = new OutputFormat("0", "user_exist", "").toString();
	private static String jiaowuidRepeatErrorFormat = new OutputFormat("0", "jiaowuid_repeat", "").toString();
	private static String emailRepeatErrorFormat = new OutputFormat("0", "email_exist", "").toString();
	private static String wrongParameterErrorFormat = new OutputFormat("0", "wrong_parameter", "").toString();
	private static String unknownErrorFormat = new OutputFormat("0", "unknown_exception", "").toString();
	private static String itemExistsErrorFormat = new OutputFormat("0", "item_exist", "").toString();
	private static String successResult = "1";
	private static String successMsg = "ok";
	private static String failResult = "0";
	private static String failData = "";
	public static String createJsonString(Object data) {
		return new OutputFormat(successResult, successMsg, data).toString();
	}
	public static String createJsonStringWithFormat(Object data, DateFormat dateFormat) {
		OutputFormat format = new OutputFormat(successResult, successMsg, data);
		format.setDateFormat(dateFormat);
		return format.toString();
	}
	public static String createJsonForDataString(String data) {
		return new OutputFormat(successResult, successMsg, data).toStringWithOutQuote();
	}
	public static String createJsonForDataStringQuote(String data) {
		return new OutputFormat(successResult, successMsg, data).toStringWithQuote();
	} 
	public static String createJsonStringError(String msg) {
		return new OutputFormat(failResult, msg, failData).toStringWithQuote();
	}
	public static String createJsonInValid() {
		return validErrorFormat;
	}
	public static String creasteJsonRepeatUser() {
		return repeatErrorFormat; 
	}
	public static String creasteJsonExistsUser() {
		return existsErrorFormat; 
	}
	public static String createJsonJiaowuidRepeat() {
		return jiaowuidRepeatErrorFormat;
	}
	public static String creasteJsonEmailRepeat() {
		return emailRepeatErrorFormat; 
	}
	public static String creasteJsonUnknown() {
		return unknownErrorFormat; 
	}
	public static String creasteJsonWrongParameter() {
		return wrongParameterErrorFormat; 
	}
	public static String creasteJsonItemExists() {
		return itemExistsErrorFormat; 
	}
}
